<?php
	$res = imagecreatetruecolor(100, 50);
	$red = imagecolorallocate($res, 255, 0, 0);
	imagefill($res,0,0,$red);
	$logo = imagecreatefrompng("logo.png");
	$jpg = imagecreatefromjpeg("1.jpg");
	// imagecopy($jpg, $logo, imagesx($jpg)-imagesx($logo)-20,  imagesy($jpg)-imagesy($logo)-20,
	// 0,0, imagesx($logo),imagesy($logo));
	$box = imagettfbbox(20,0,  "./font/simhei.ttf", "后盾网  人人做后盾");
	$w = $box[2]-$box[0];//文字宽度
	$h = $box[3]-$box[5];//文字高度
	// print_r($box);exit;
	imagettftext($jpg, 20, 0, imagesx($jpg)-$w-20,imagesy($jpg)-20, imagecolorallocate($jpg, 255,0, 0), "./font/simhei.ttf", "后盾网  人人做后盾");
	header("Content-type:image/jpeg");
	imagejpeg($jpg);


	// header("Content-type:image/jpeg");
	// imagestring($jpg, 5,100,100,"sdjksdfjksdfdfsdfsdfjksdfsdf", imagecolorallocate($jpg, 255, 0, 0));
	
	// imagejpeg($jpg);
	// 1000  
	// echo imagesy($jpg); 
	// print_r(getimagesize("1.jpg"));

?>